
//分离条件
import {INCREAMENT,DECREAMENTCOUNT} from '../../store/constant/countContant'

//分离Action

//初始值
const init = {
  count: 0
}
export default function countReducer(prestate = init, action) {
  const { type, data } = action
  
  switch (type) {
    case INCREAMENT:
      return {
        ...init,
        count: prestate.count + data
      };
    case DECREAMENTCOUNT:
      return {
        ...init,
        count: prestate.count - data
      }
  }


  return prestate
}
